package com.example.Laboratory.Service.Impl;

import com.example.Laboratory.Entity.Friendship;
import com.example.Laboratory.Mapper.FriendshipMapper;
import com.example.Laboratory.Service.FriendshipService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class FriendshipServiceImpl implements FriendshipService {


    @Autowired
    FriendshipMapper friendshipMapper;


    //增加友情链接
    @Override
    public String addFriendship(Friendship t) {
        if (friendshipMapper.addFriendship(t) == 1) {
            return "添加成功";
        } else {
            return "添加失败";
        }
    }


    //查找友情链接
    @Override
    public List<Friendship> selectFriendship() {
        return friendshipMapper.selectFriendship();
    }

    //删除友情链接
    @Override
    public String deleteFriendship(int friendship_id) {
        if (friendshipMapper.deleteFriendship(friendship_id) == 1) {
            return "删除成功";
        } else {
            return "删除失败";
        }
    }


    //修改友情链接
    @Override
    public String updateFriendship(Friendship i) {
        if (friendshipMapper.updateFriendship(i) == 1) {
            return "修改成功";
        } else {
            return "修改失败";
        }
    }

}